package com.bbs.action;

import java.io.IOException;
import java.util.List;

import com.bbs.dao.PrivilegeDao;
import com.bbs.dao.impl.PrivilegeDaoImpl;
import com.bbs.model.Privilege;

public class PrivilegeAction extends BaseAction{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 
	 */
	private Privilege privilege;
	private PrivilegeDao privilegeDao;
	private List<Privilege> privilegeList;
	
	public String addPrivilege() throws IOException{
		privilegeDao=new PrivilegeDaoImpl();
		privilegeDao.save(privilege);
		return "addPrivilege";
	}
	
	
	public String updatePrivilege() throws IOException{
		
		privilegeDao=new PrivilegeDaoImpl();
		privilegeDao.update(privilege);
		return "addTopic";
	}
	public String deletePrivilege() throws IOException{
		privilegeDao=new PrivilegeDaoImpl();
		privilegeDao.delete(privilege.getPriv_id());
		return " deletePrivilege";
	}
	
	public String  listPrivilege() throws IOException{		
		privilegeDao=new PrivilegeDaoImpl();
		privilegeList=privilegeDao.findAll();
		return "listPrivilege";
	}


	public Privilege getPrivilege() {
		return privilege;
	}


	public void setPrivilege(Privilege privilege) {
		this.privilege = privilege;
	}

	public List<Privilege> getPrivilegeList() {
		return privilegeList;
	}


	public void setPrivilegeList(List<Privilege> privilegeList) {
		this.privilegeList = privilegeList;
	}
}
